1 using System.Collections;
2 using
System.Collections.Generic;
3 using
UnityEngine;
4 using
UnityEngine.UI;
5
6 public
class ToggleValue : MonoBehaviour {
7
8     
public Toggle toggle;
9     
public Text toggleText;
10
11     
private bool init = false;
12
13     
void Awake() {
14         
int value = PlayerPrefs.GetInt(GameManager.CAMERA_VIEW,0);
15         toggle.isOn = (
value == 1) ? true : false;
16         init =
true;
17     }
18
19     
public void OnValueChanged() {
20         
bool value = toggle.isOn;
21         PlayerPrefs.SetInt(GameManager.CAMERA_VIEW,(
value) ? 1 : 0);
22     }
23 }


Gõ tìm kiếm nhanh...